home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dump_s1r / frmbtnma.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-12-20  |  14.7 KB  |  479 lines

  1. VERSION 5.00
  2. Begin VB.Form frmbtnMaker 
  3.    AutoRedraw      =   -1  'True
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Button Collection"
  6.    ClientHeight    =   4800
  7.    ClientLeft      =   45
  8.    ClientTop       =   300
  9.    ClientWidth     =   6360
  10.    BeginProperty Font 
  11.       Name            =   "MS Sans Serif"
  12.       Size            =   8.25
  13.       Charset         =   0
  14.       Weight          =   700
  15.       Underline       =   0   'False
  16.       Italic          =   0   'False
  17.       Strikethrough   =   0   'False
  18.    EndProperty
  19.    Icon            =   "frmbtnMaker.frx":0000
  20.    LinkTopic       =   "Form1"
  21.    MaxButton       =   0   'False
  22.    MinButton       =   0   'False
  23.    ScaleHeight     =   4800
  24.    ScaleWidth      =   6360
  25.    StartUpPosition =   2  'CenterScreen
  26.    Begin VB.CommandButton cmdMakeCode 
  27.       Caption         =   "Generate Code"
  28.       BeginProperty Font 
  29.          Name            =   "MS Sans Serif"
  30.          Size            =   8.25
  31.          Charset         =   0
  32.          Weight          =   400
  33.          Underline       =   0   'False
  34.          Italic          =   0   'False
  35.          Strikethrough   =   0   'False
  36.       EndProperty
  37.       Height          =   465
  38.       Left            =   2310
  39.       TabIndex        =   14
  40.       Top             =   3390
  41.       Width           =   1395
  42.    End
  43.    Begin VB.CommandButton cmdDelete 
  44.       Caption         =   "Delete"
  45.       BeginProperty Font 
  46.          Name            =   "MS Sans Serif"
  47.          Size            =   8.25
  48.          Charset         =   0
  49.          Weight          =   400
  50.          Underline       =   0   'False
  51.          Italic          =   0   'False
  52.          Strikethrough   =   0   'False
  53.       EndProperty
  54.       Height          =   465
  55.       Left            =   3030
  56.       TabIndex        =   13
  57.       Top             =   2880
  58.       Width           =   1395
  59.    End
  60.    Begin VB.CommandButton cmdAdd 
  61.       Caption         =   "Add"
  62.       BeginProperty Font 
  63.          Name            =   "MS Sans Serif"
  64.          Size            =   8.25
  65.          Charset         =   0
  66.          Weight          =   400
  67.          Underline       =   0   'False
  68.          Italic          =   0   'False
  69.          Strikethrough   =   0   'False
  70.       EndProperty
  71.       Height          =   465
  72.       Left            =   1590
  73.       TabIndex        =   12
  74.       Top             =   2880
  75.       Width           =   1395
  76.    End
  77.    Begin VB.PictureBox Picture1 
  78.       BackColor       =   &H00808080&
  79.       BorderStyle     =   0  'None
  80.       BeginProperty Font 
  81.          Name            =   "MS Sans Serif"
  82.          Size            =   8.25
  83.          Charset         =   0
  84.          Weight          =   400
  85.          Underline       =   0   'False
  86.          Italic          =   0   'False
  87.          Strikethrough   =   0   'False
  88.       EndProperty
  89.       Height          =   2775
  90.       Left            =   1590
  91.       ScaleHeight     =   2775
  92.       ScaleWidth      =   4725
  93.       TabIndex        =   6
  94.       Top             =   60
  95.       Width           =   4725
  96.       Begin VB.CommandButton cmdSize 
  97.          BeginProperty Font 
  98.             Name            =   "MS Sans Serif"
  99.             Size            =   8.25
  100.             Charset         =   0
  101.             Weight          =   400
  102.             Underline       =   0   'False
  103.             Italic          =   0   'False
  104.             Strikethrough   =   0   'False
  105.          EndProperty
  106.          Height          =   495
  107.          Left            =   0
  108.          TabIndex        =   7
  109.          Top             =   0
  110.          Width           =   1425
  111.       End
  112.    End
  113.    Begin VB.TextBox txtName 
  114.       BeginProperty Font 
  115.          Name            =   "MS Sans Serif"
  116.          Size            =   8.25
  117.          Charset         =   0
  118.          Weight          =   400
  119.          Underline       =   0   'False
  120.          Italic          =   0   'False
  121.          Strikethrough   =   0   'False
  122.       EndProperty
  123.       Height          =   285
  124.       Left            =   0
  125.       TabIndex        =   5
  126.       Top             =   300
  127.       Width           =   1490
  128.    End
  129.    Begin VB.TextBox txtCap 
  130.       BeginProperty Font 
  131.          Name            =   "MS Sans Serif"
  132.          Size            =   8.25
  133.          Charset         =   0
  134.          Weight          =   400
  135.          Underline       =   0   'False
  136.          Italic          =   0   'False
  137.          Strikethrough   =   0   'False
  138.       EndProperty
  139.       Height          =   285
  140.       Left            =   0
  141.       TabIndex        =   3
  142.       Top             =   840
  143.       Width           =   1490
  144.    End
  145.    Begin VB.CommandButton cmdPrev 
  146.       Caption         =   "Preview"
  147.       Default         =   -1  'True
  148.       BeginProperty Font 
  149.          Name            =   "MS Sans Serif"
  150.          Size            =   8.25
  151.          Charset         =   0
  152.          Weight          =   400
  153.          Underline       =   0   'False
  154.          Italic          =   0   'False
  155.          Strikethrough   =   0   'False
  156.       EndProperty
  157.       Height          =   405
  158.       Left            =   2220
  159.       TabIndex        =   1
  160.       Top             =   4320
  161.       Width           =   1695
  162.    End
  163.    Begin VB.PictureBox pSp 
  164.       AutoRedraw      =   -1  'True
  165.       BorderStyle     =   0  'None
  166.       Height          =   315
  167.       Left            =   2310
  168.       ScaleHeight     =   315
  169.       ScaleWidth      =   1485
  170.       TabIndex        =   0
  171.       Top             =   3990
  172.       Width           =   1485
  173.    End
  174.    Begin VB.Label l 
  175.       AutoSize        =   -1  'True
  176.       Caption         =   "Height"
  177.       BeginProperty Font 
  178.          Name            =   "MS Sans Serif"
  179.          Size            =   8.25
  180.          Charset         =   0
  181.          Weight          =   400
  182.          Underline       =   0   'False
  183.          Italic          =   0   'False
  184.          Strikethrough   =   0   'False
  185.       EndProperty
  186.       Height          =   195
  187.       Index           =   5
  188.       Left            =   0
  189.       TabIndex        =   11
  190.       Top             =   2730
  191.       Width           =   465
  192.    End
  193.    Begin VB.Label l 
  194.       AutoSize        =   -1  'True
  195.       Caption         =   "Width"
  196.       BeginProperty Font 
  197.          Name            =   "MS Sans Serif"
  198.          Size            =   8.25
  199.          Charset         =   0
  200.          Weight          =   400
  201.          Underline       =   0   'False
  202.          Italic          =   0   'False
  203.          Strikethrough   =   0   'False
  204.       EndProperty
  205.       Height          =   195
  206.       Index           =   4
  207.       Left            =   0
  208.       TabIndex        =   10
  209.       Top             =   2220
  210.       Width           =   420
  211.    End
  212.    Begin VB.Label l 
  213.       AutoSize        =   -1  'True
  214.       Caption         =   "Top"
  215.       BeginProperty Font 
  216.          Name            =   "MS Sans Serif"
  217.          Size            =   8.25
  218.          Charset         =   0
  219.          Weight          =   400
  220.          Underline       =   0   'False
  221.          Italic          =   0   'False
  222.          Strikethrough   =   0   'False
  223.       EndProperty
  224.       Height          =   195
  225.       Index           =   3
  226.       Left            =   0
  227.       TabIndex        =   9
  228.       Top             =   1680
  229.       Width           =   285
  230.    End
  231.    Begin VB.Label l 
  232.       AutoSize        =   -1  'True
  233.       Caption         =   "Left"
  234.       BeginProperty Font 
  235.          Name            =   "MS Sans Serif"
  236.          Size            =   8.25
  237.          Charset         =   0
  238.          Weight          =   400
  239.          Underline       =   0   'False
  240.          Italic          =   0   'False
  241.          Strikethrough   =   0   'False
  242.       EndProperty
  243.       Height          =   195
  244.       Index           =   2
  245.       Left            =   0
  246.       TabIndex        =   8
  247.       Top             =   1170
  248.       Width           =   270
  249.    End
  250.    Begin VB.Label l 
  251.       AutoSize        =   -1  'True
  252.       Caption         =   "Name"
  253.       BeginProperty Font 
  254.          Name            =   "MS Sans Serif"
  255.          Size            =   8.25
  256.          Charset         =   0
  257.          Weight          =   400
  258.          Underline       =   0   'False
  259.          Italic          =   0   'False
  260.          Strikethrough   =   0   'False
  261.       EndProperty
  262.       Height          =   195
  263.       Index           =   0
  264.       Left            =   0
  265.       TabIndex        =   4
  266.       Top             =   60
  267.       Width           =   420
  268.    End
  269.    Begin VB.Label l 
  270.       AutoSize        =   -1  'True
  271.       Caption         =   "Caption"
  272.       BeginProperty Font 
  273.          Name            =   "MS Sans Serif"
  274.          Size            =   8.25
  275.          Charset         =   0
  276.          Weight          =   400
  277.          Underline       =   0   'False
  278.          Italic          =   0   'False
  279.          Strikethrough   =   0   'False
  280.       EndProperty
  281.       Height          =   195
  282.       Index           =   1
  283.       Left            =   0
  284.       TabIndex        =   2
  285.       Top             =   600
  286.       Width           =   540
  287.    End
  288. Attribute VB_Name = "frmbtnMaker"
  289. Attribute VB_GlobalNameSpace = False
  290. Attribute VB_Creatable = False
  291. Attribute VB_PredeclaredId = True
  292. Attribute VB_Exposed = False
  293. Private WithEvents pSpin As Spin
  294. Attribute pSpin.VB_VarHelpID = -1
  295. Private WithEvents s_Left As Spin
  296. Attribute s_Left.VB_VarHelpID = -1
  297. Private WithEvents s_Top As Spin
  298. Attribute s_Top.VB_VarHelpID = -1
  299. Private WithEvents s_Width As Spin
  300. Attribute s_Width.VB_VarHelpID = -1
  301. Private WithEvents s_Height As Spin
  302. Attribute s_Height.VB_VarHelpID = -1
  303. '--------------------------------'
  304. Dim m_ColBtn As ButtonMngr
  305. Private Sub cmdAdd_Click()
  306. Static int_NumCreat As Integer
  307. int_NumCreat = int_NumCreat + 1
  308. m_ColBtn.AddButton "cmdNew" & int_NumCreat, "New Btn" & int_NumCreat, 0, 0, 1000, 400, BackColor, Nothing, Nothing
  309. pSpin.MaxValue = m_ColBtn.Count
  310. pSpin.MinValue = 1
  311. pSpin.Value = 1
  312. pSpin.Redraw
  313. End Sub
  314. Private Sub cmdDelete_Click()
  315.     If pSpin.Value = 0 Then Exit Sub
  316.     m_ColBtn.Remove pSpin.Value
  317.     If pSpin.MaxValue = 1 Then
  318.     pSpin.MinValue = 0
  319.     pSpin.Value = 0
  320.     pSpin.MaxValue = 0
  321.     End If
  322. End Sub
  323. Private Sub cmdMakeCode_Click()
  324. Clipboard.Clear
  325. Clipboard.SetText BtnMngrToCode(m_ColBtn)
  326. End Sub
  327. Private Sub Form_Load()
  328. Set m_ColBtn = New ButtonMngr
  329. Set pSpin = New Spin
  330. Set s_Left = New Spin
  331. Set s_Top = New Spin
  332. Set s_Width = New Spin
  333. Set s_Height = New Spin
  334. pSpin.ChangeRate = 1
  335. s_Left.Enabled = True
  336. s_Top.Enabled = True
  337. s_Width.Enabled = True
  338. s_Height.Enabled = True
  339. Set s_Left.Parent = Me
  340. Set s_Top.Parent = Me
  341. Set s_Width.Parent = Me
  342. Set s_Height.Parent = Me
  343. s_Left.Left = l(2).Left
  344. s_Left.Top = l(2).Top + l(2).Height
  345. s_Left.Height = 300
  346. s_Left.Width = 1490
  347. s_Left.MinValue = -1000
  348. s_Top.Left = l(3).Left
  349. s_Top.Top = l(3).Top + l(3).Height
  350. s_Top.Height = 300
  351. s_Top.Width = 1490
  352. s_Top.MinValue = -400
  353. s_Width.Left = l(4).Left
  354. s_Width.Top = l(4).Top + l(4).Height
  355. s_Width.Height = 300
  356. s_Width.Width = 1490
  357. s_Width.MaxValue = 2750
  358. s_Height.Left = l(5).Left
  359. s_Height.Top = l(5).Top + l(5).Height
  360. s_Height.Height = 300
  361. s_Height.Width = 1490
  362. s_Height.MaxValue = 2750
  363. s_Height.ChangeRate = Screen.TwipsPerPixelY
  364. s_Left.MaxValue = Picture1.Width - 1000
  365. s_Top.MaxValue = Picture1.Height - 400
  366. s_Width.ChangeRate = Screen.TwipsPerPixelY
  367. s_Left.ChangeRate = Screen.TwipsPerPixelX * 2
  368. s_Top.ChangeRate = Screen.TwipsPerPixelY * 2
  369. pSpin.Enabled = True
  370. pSpin.Height = pSp.ScaleHeight
  371. pSpin.Width = pSp.ScaleWidth
  372. pSpin.MaxValue = m_ColBtn.Count
  373. Set pSpin.Parent = pSp
  374. pSpin.Redraw
  375. s_Left.Redraw
  376. s_Top.Redraw
  377. s_Width.Redraw
  378. s_Height.Redraw
  379. End Sub
  380. Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  381. s_Left.MouseDown Button, X, Y
  382. s_Top.MouseDown Button, X, Y
  383. s_Width.MouseDown Button, X, Y
  384. s_Height.MouseDown Button, X, Y
  385. End Sub
  386. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  387. s_Left.MouseMove Button, X, Y
  388. s_Top.MouseMove Button, X, Y
  389. s_Width.MouseMove Button, X, Y
  390. s_Height.MouseMove Button, X, Y
  391. End Sub
  392. Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  393. s_Left.MouseUp Button, X, Y
  394. s_Top.MouseUp Button, X, Y
  395. s_Width.MouseUp Button, X, Y
  396. s_Height.MouseUp Button, X, Y
  397. End Sub
  398. Private Sub pSp_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  399. pSpin.MouseDown Button, X, Y
  400. End Sub
  401. Private Sub pSp_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  402. pSpin.MouseMove Button, X, Y
  403. End Sub
  404. Private Sub pSp_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
  405. pSpin.MouseUp Button, X, Y
  406. End Sub
  407. Private Sub pSpin_Changed(PropertyName As String)
  408. If PropertyName = "Value" Then
  409.     If pSpin.Value = 0 Then Exit Sub
  410.     With m_ColBtn.Buttons(pSpin.Value)
  411.     cmdSize.Visible = False
  412.     txtCap = .Caption
  413.     txtName = .Name
  414.     s_Height = .Height
  415.     s_Width = .Width
  416.     s_Left = .Left
  417.     s_Top = .Top
  418.     cmdSize.Visible = True
  419.     End With
  420. End If
  421. End Sub
  422. Private Sub s_Height_Changed(PropertyName As String)
  423.     Static InProc As Boolean
  424.     If InProc Then Exit Sub
  425.     InProc = True
  426.     If PropertyName = "Value" Then
  427.         If pSpin = 0 Then s_Height = 0: InProc = False: Exit Sub
  428.     End If
  429.     cmdSize.Height = s_Height
  430.     On Error Resume Next
  431.     m_ColBtn.Buttons(pSpin.Value).Height = s_Height
  432.     InProc = False
  433. End Sub
  434. Private Sub s_Left_Changed(PropertyName As String)
  435.     Static InProc As Boolean
  436.     If InProc Then Exit Sub
  437.     InProc = True
  438.     If PropertyName = "Value" Then
  439.         If pSpin = 0 Then s_Left = 0: InProc = False: Exit Sub
  440.     End If
  441.     cmdSize.Left = s_Left
  442.     On Error Resume Next
  443.     m_ColBtn.Buttons(pSpin.Value).Left = s_Left
  444.     InProc = False
  445. End Sub
  446. Private Sub s_Top_Changed(PropertyName As String)
  447.     Static InProc As Boolean
  448.     If InProc Then Exit Sub
  449.     InProc = True
  450.     If PropertyName = "Value" Then
  451.     If pSpin.Value = 0 Then s_Top.Value = 0: InProc = False: Exit Sub
  452.     End If
  453.     cmdSize.Top = s_Top.Value
  454.     On Error Resume Next
  455.     m_ColBtn.Buttons(pSpin.Value).Top = s_Top
  456.     InProc = False
  457. End Sub
  458. Private Sub s_Width_Changed(PropertyName As String)
  459.     Static InProc As Boolean
  460.     If InProc Then Exit Sub
  461.     InProc = True
  462.     If PropertyName = "Value" Then
  463.         If pSpin = 0 Then s_Width = 0: InProc = False: Exit Sub
  464.     End If
  465.     cmdSize.Width = s_Width
  466.     On Error Resume Next
  467.     m_ColBtn.Buttons(pSpin.Value).Width = s_Width
  468.     InProc = False
  469. End Sub
  470. Private Sub txtCap_Change()
  471.     If pSpin.Value = 0 Then Exit Sub
  472.     cmdSize.Caption = txtCap
  473.     m_ColBtn.Buttons(pSpin.Value).Caption = txtCap
  474. End Sub
  475. Private Sub txtName_Change()
  476.     If pSpin.Value = 0 Then Exit Sub
  477.     m_ColBtn.Buttons(pSpin.Value).Name = txtName
  478. End Sub
  479.